package com.tjh.spring5.testdemo;

import com.tjh.spring5.bean.Emp;
import com.tjh.spring5.service.UserService;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Create by koala on 2021-02-16
 */
public class TestBeanDay08 {

    //day08
    @Test
    public void testBean1() {
        //1 加载spring配置文件
        ApplicationContext context =
                new ClassPathXmlApplicationContext("beanday08.xml");

        //2 获取配置创建的对象
        UserService userService = context.getBean("userService", UserService.class);

        userService.add();
    }

    //day09
    @Test
    public void testBean2() {
        //1 加载spring配置文件
        ApplicationContext context =
                new ClassPathXmlApplicationContext("beanday09.xml");

        //2 获取配置创建的对象
        Emp emp = context.getBean("emp", Emp.class);

        emp.add();
    }

    //day10
    @Test
    public void testBean3() {
        //1 加载spring配置文件
        ApplicationContext context =
                new ClassPathXmlApplicationContext("beanday10.xml");

        //2 获取配置创建的对象
        Emp emp = context.getBean("emp", Emp.class);

        emp.add();
    }

    //day11
    @Test
    public void testBean4() {
        //1 加载spring配置文件
        ApplicationContext context =
                new ClassPathXmlApplicationContext("beanday11.xml");

        //2 获取配置创建的对象
        Emp emp = context.getBean("emp", Emp.class);

        emp.add();
    }

}
